#if (FEATURE_MODE == 0)
/**
 @file sys_usw_srv6.h

 @date 2019-1-1

 @version v6.0

Macro, data structure for system common operations

*/

#ifndef _SYS_USW_SRV6
#define _SYS_USW_SRV6
#ifdef __cplusplus
extern "C" {
#endif

#include "sal.h"
#include "ctc_srv6.h"
#include "ctc_const.h"

/***************************************************************
 *
 *  Defines and Macros
 *
 ***************************************************************/
#define SRV6_INIT 0
#define SRV6_DEINIT 1

#define SYS_SID_MASK(sid, len)                              \
    {                                                       \
        uint8 feedlen = CTC_IPV6_ADDR_LEN_IN_BIT - (len);   \
        uint8 sublen = feedlen % 32;                        \
        int8 index = feedlen / 32;                          \
        if (sublen)                                          \
        {                                                   \
            uint32 mask_temp = ~((1 << sublen) - 1);        \
            (sid)[index] &= mask_temp;                      \
        }                                                   \
        index--;                                            \
        for (; index >= 0; index--)                          \
        {                                                   \
            (sid)[index] = 0;                                \
        }                                                   \
        for (index = 0; index < 4; index++)                  \
        {                                                    \
            (sid)[index] = ~(sid)[index];                     \
        }                                                    \
    }
/***************************************************************
 *
 *  Functions
 *
 ***************************************************************/
extern int32
sys_usw_srv6_init(uint8 lchip, ctc_srv6_global_cfg_t* p_global_cfg);
extern int32
sys_usw_srv6_deinit(uint8 lchip);
extern int32
sys_usw_srv6_add_my_sid(uint8 lchip, ctc_srv6_sid_t* my_sid);
extern int32
sys_usw_srv6_remove_my_sid(uint8 lchip, ctc_srv6_sid_t* my_sid);
extern int32
sys_usw_srv6_update_my_sid(uint8 lchip, ctc_srv6_sid_t* my_sid);
extern int32
sys_usw_srv6_set_global_cfg(uint8 lchip, ctc_srv6_global_cfg_t* p_global_cfg, uint8 masklen, uint8 scl_id);
extern int32
sys_usw_srv6_set_sid_format(uint8 lchip, ctc_srv6_global_cfg_t* p_global_cfg);

#ifdef __cplusplus
}
#endif

#endif

#endif

